/**
 * 
 */
package com.flux.tms.tm${bean.numMain}srv.t${bean.numMain}${bean.numSub}.impl.service;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.flux.tms.tm${bean.numMain}srv.t${bean.numMain}${bean.numSub}.${detail.javaFlieName}CVal;
import com.flux.tms.tm${bean.numMain}srv.t${bean.numMain}${bean.numSub}.impl.dao.Add${detail.javaFlieName}Dao;
import com.flux.tms.tm${bean.numMain}srv.t${bean.numMain}${bean.numSub}.impl.dao.${detail.javaFlieName}Dao;
import com.flux.scev6.constant.CommonCVal;
import com.flux.scev6.dbopr.BaseDao;
import com.flux.scev6.login.model.LoginInfoObj;
import com.flux.scev6.dbopr.model.ResultObj;
import com.flux.scev6.extendopr.api.StdBizExtExecuteService;

/**
 * 
 * T${bean.numMain}${bean.numSub} ${bean.notesMain} -- ${detail.subName}   -- srv 新增数据   Service 实现
 * 
 * T${bean.numMain}${bean.numSub} ${detail.subName}
 * 
 * <p>
 * 创建时间：${bean.dayTime}
 * <p>
 * 
 * <p>
 * 修改时间：${bean.dayTime}
 * <p>
 * 
 * @author ${bean.author}
 * 
 * @version V1.0.0
 *
 */
@Service
@Transactional(rollbackFor=Exception.class)
public class Add${detail.javaFlieName}Service {
	/**
	 * V100(${bean.numTime}) ${bean.author} 初版。
	 */
	@SuppressWarnings("unused")
	private static String verNum = "V100(${bean.numTime})";// 版本号

	@Autowired
	private ${detail.javaFlieName}Dao ${detail.javaFlieName}Dao;
	@Autowired
	private Add${detail.javaFlieName}Dao add${detail.javaFlieName}Dao;
	@Autowired
    private StdBizExtExecuteService stdBizExtExecuteService;

	/**
	 * 查询  ${detail.subName} 数据
	 * 
	 * 
	 * @date ${bean.dayTime}
	 * 
	 * @param loginInfoObj 登录信息
	 * @param bizDataMap  提交参数
	 * @return
	 */
	public Map<String, Object> get${detail.javaFlieName}(LoginInfoObj loginInfoObj, Map<String, String> bizDataMap) {
		return ${detail.javaFlieName}Dao.get${detail.javaFlieName}Info(loginInfoObj, bizDataMap);
	}
	
	/**
	 * 查询  ${detail.subName} 数据
	 * 
	 * 
	 * @date ${bean.dayTime}
	 * 
	 * @param loginInfoObj 登录信息
	 * @param bizDataMap  提交参数
	 * @return
	 */
	public Map<String, Object> get${detail.javaFlieName}(LoginInfoObj loginInfoObj, Map<String, String> bizDataMap,
			String otherReturnFields) {
		return ${detail.javaFlieName}Dao.get${detail.javaFlieName}Info(loginInfoObj, bizDataMap, otherReturnFields);
	}
	
	
	/**
	 * 提交数据 (这里的所有操作放在一个事务中，抛出异常将会触发事务回滚操作)
	 *
	 * @date: ${bean.dayTime}
	 * 
	 * @param loginInfoObj
	 * @param bizDataMap
	 * @return
	 * @throws Exception
	 */
	public ResultObj postData(LoginInfoObj loginInfoObj, Map<String, String> bizDataMap) throws Exception {
		ResultObj resultObj = new ResultObj();
		// ==================================================================================
		// ==================================================================================
		// 20181201 jingdy 调用标准业务功能扩展逻辑 - 前置操作  EDT   DEL
        String functionId = ${detail.javaFlieName}CVal.FUNC_ID;
        String actionCode = "ADD"; // 默认使用 BSM_FUNCTION_ACTION.actionId 的值
        String extendType = CommonCVal.STDBIZ_EXT_TYPE_PRE_IN; // 前置操作
        stdBizExtExecuteService.executeInTrans(loginInfoObj, bizDataMap, functionId, actionCode, extendType);
		// ==================================================================================
		add${detail.javaFlieName}Dao.setTimeZone(loginInfoObj);
		// 执行插入操作
		add${detail.javaFlieName}Dao.insert${detail.javaFlieName}1H(loginInfoObj, bizDataMap);
		
		// ==================================================================================
		// ==================================================================================
		// 20181201 jingdy 调用标准业务功能扩展逻辑 - 后置操作
        extendType = CommonCVal.STDBIZ_EXT_TYPE_POST_IN; // 后置操作
        stdBizExtExecuteService.executeInTrans(loginInfoObj, bizDataMap,functionId, actionCode, extendType);
		// ==================================================================================
		// 操作成功
		resultObj.setCodeValueOK();
		return resultObj;
	}

	<#if (bean.systemCodeList)?size !=0>
	/**
	 * 获取系统代码数据
	 *
	 * @author ${bean.author}
	 *
	 * @date ${bean.dayTime}
	 * 
	 * @param loginInfoObj
	 * @param bizDataMap
	 * @param codeId
	 * @return
	 */
	public Map<String, Object> getSystemCode(LoginInfoObj loginInfoObj, Map<String, String> bizDataMap,
			String codeId,String codeType) {
		return ${detail.javaFlieName}Dao.getSystemCodeInfo(loginInfoObj, bizDataMap, codeId,codeType);
	}
	</#if>
	<#if (detail.otherCodeList)?size !=0>
		<#list (detail.otherCodeList) as otherTable>
	public Map<String, Object> get${(otherTable.codeName)?cap_first}(LoginInfoObj loginInfoObj, Map<String, String> bizDataMap,
			String parentAreaFields) {
		return ${detail.javaFlieName}Dao.get${(otherTable.codeName)?cap_first}DataInfo(loginInfoObj, bizDataMap, parentAreaFields);
	}
		</#list>
	</#if>

}
